#include <tuple>
#include <map>
#include <array>

using namespace std;

template <typename T>
class Graph
{
public:
    Graph();
    virtual ~Graph(){};
    int AddNode(T data);
    bool AddEdge(int from, int to, int weight);
    bool RemoveNode(int id);
    bool RemoveEdge(int from, int to);
    bool HasEdge(int from, int to) const;
    tuple<bool, T> GetNode(int id);
    int Size() const;

private:
    map<int, T> nodes;
    map<array<int, 2>, int> edges;
    int size, id;
};
